<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:include value="/WEB-INF/content/common/header.jsp" />
<title><s:text name="global.application.title" /> - <s:text
		name="global.title.input" /></title>
		
<style>

input[readonly="readonly"]{
	background-color: #ffffff;
	}

</style>

</head>
<body>
	<div class="container-fluid">
		<div class="row-fluid">
			<s:include value="/WEB-INF/content/common/title-head.jsp" />
		</div>
		<div class="row-fluid">
			<div class="container-fluid well">
				<div class="center">
					<div class="input-prepend input-append ">
						<div class=" bootstrap-timepicker vitaltimepicker">
							<span class="add-on" style="-webkit-border-radius: 4px 0 0 4px; -moz-border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px;">
							<s:text name="implimentation.time" /></span>
							<s:textfield id="timepicker" name="time" cssClass="input-small" />
							<span class="add-on"> <i class="icon-time"></i>
							</span>
							<button class="btn btn-custom" id="btnCurrentTime">
								<s:text name="btn.current.time" />
							</button>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="row-fluid">
			<div class="wellwhite" id="data">
				<s:form namespace="/input" action="saveVital" id="vitalform">
					<s:hidden name="inputGroup" value="バイタル" />
					<s:hidden name="plannedTime" id="plannedTime"/>
						<div class="table-responsive vitaltable">
							<table class="table table-bordered vitaltable">
								<tr>
								<td style="vertical-align: middle; text-align:center;" colspan=3 ><h5><s:text name="input.vital"/></h5></td>
								</tr>
									<tr>
										<td style="vertical-align: middle" class="span2"><s:text name="input.vital.BPH"/></td>
										<td style="vertical-align: middle" class="record-items">  
											<!-- <input type="text" name="ansTxtInt" value="" id="save_ansTxtInt" class="INTEGER txt_input" style="text-align:right"/> -->
											<div class="bootstrap-timepicker-widget open span2">
												<table class="table table-bordered">
												    <tbody>
												        <tr>
												            <td><a class="valuechanger" href="#" onclick="decrementValue('#vital0')"><i class="icon-chevron-left"></i></a>
												            </td>
												       
												            <td>
												                <input name="ansTxtInt" id="vital0" class="bootstrap-timepicker-hour INTEGER vitalinputs" style="margin-top:3px;" readonly="readonly" maxlength="3" type="text">
												            </td>
											
												            <td><a class="valuechanger" href="#" onclick="incrementValue('#vital0')"><i class="icon-chevron-right"></i></a>
												            </td>
												        </tr>
												    </tbody>
												</table>
											</div>
											<input type="hidden" name="ansTxtIntHidden" value="血圧（上）" id="save_ansTxtIntHidden"/>
										</td>
										<td>
											<a onclick="getDefaultValue('#vital0')">
												<img src="../theme/img/setdefault.png" class="btn vitalbtn">
											</a>
										</td>
									</tr>
								
									<tr>
										<td style="vertical-align: middle" class="span2"><s:text name="input.vital.BPL"/></td>
										<td style="vertical-align: middle" class="record-items">  
											<!-- <input type="text" name="ansTxtInt" value="" id="save_ansTxtInt" class="INTEGER txt_input" style="text-align:right"/> -->
											<div class="bootstrap-timepicker-widget open span2">
												<table class="table table-bordered">
												    <tbody>
												        <tr>
												            <td><a class="valuechanger" href="#" onclick="decrementValue('#vital1')"><i class="icon-chevron-left"></i></a>
												            </td>
												       
												            <td>
												                <input name="ansTxtInt" id="vital1" class="bootstrap-timepicker-hour INTEGER vitalinputs" style="margin-top:3px;" readonly="readonly" maxlength="3" type="text">
												            </td>
											
												            <td><a class="valuechanger" href="#" onclick="incrementValue('#vital1')"><i class="icon-chevron-right"></i></a>
												            </td>
												        </tr>
												    </tbody>
												</table>
											</div>
											<input type="hidden" name="ansTxtIntHidden" value="血圧（下）" id="save_ansTxtIntHidden"/>
										</td>
										<td>
											<a onclick="getDefaultValue('#vital1')">
												<img src="../theme/img/setdefault.png" class="btn vitalbtn">
											</a>
										</td>
									</tr>
								
									<tr>
										<td style="vertical-align: middle" class="span2"><s:text name="input.vital.PR"/></td>
										<td style="vertical-align: middle" class="record-items">  
											<!-- <input type="text" name="ansTxtInt" value="" id="save_ansTxtInt" class="INTEGER txt_input" style="text-align:right"/> -->
											<div class="bootstrap-timepicker-widget open span2">
												<table class="table table-bordered">
												    <tbody>
												        <tr>
												            <td><a class="valuechanger" href="#" onclick="decrementValue('#vital2')"><i class="icon-chevron-left"></i></a>
												            </td>
												       
												            <td>
												                <input name="ansTxtInt" id="vital2" class="bootstrap-timepicker-hour INTEGER vitalinputs" style="margin-top:3px;" readonly="readonly" maxlength="3" type="text">
												            </td>
											
												            <td><a class="valuechanger" href="#" onclick="incrementValue('#vital2')"><i class="icon-chevron-right"></i></a>
												            </td>
												        </tr>
												    </tbody>
												</table>
											</div>
											<input type="hidden" name="ansTxtIntHidden" value="脈拍" id="save_ansTxtIntHidden"/>
										</td>
										<td>
											<a onclick="getDefaultValue('#vital2')">
												<img src="../theme/img/setdefault.png" class="btn vitalbtn">
											</a>
										</td>
									</tr>
								
									<tr>
										<td style="vertical-align: middle" class="span2"><s:text name="input.vital.BT"/></td>
										<td style="vertical-align: middle" class="record-items">   
											<!-- <input type="text" name="ansTxtDouble" value="" id="save_ansTxtDouble" class="DOUBLE txt_input" style="text-align:right"/> -->
											<div class="bootstrap-timepicker-widget open span2">
												<table class="table table-bordered">
												    <tbody>
												        <tr>
												            <td><a class="valuechanger" href="#" onclick="decrementValue('#vital3')"><i class="icon-chevron-left"></i></a>
												            </td>
												       
												            <td>
												                <input name="ansTxtDouble" id="vital3" class="bootstrap-timepicker-hour DOUBLE vitalinputs" readonly="readonly" style="margin-top:3px; width:45px;" maxlength="2" type="text">
												            </td>
											
												            <td><a class="valuechanger" href="#" onclick="incrementValue('#vital3')"><i class="icon-chevron-right"></i></a>
												            </td>
												        </tr>
												    </tbody>
												</table>
											</div>
											<input type="hidden" name="ansTxtDoubleHidden" value="体温" id="save_ansTxtDoubleHidden"/>
										</td>
										<td>
											<a onclick="getDefaultValue('#vital3')">
												<img src="../theme/img/setdefault.png" class="btn vitalbtn">
											</a>
										</td>
									</tr>
									
							</table>
							<button class="btn btn-custom pull-right" id="btnComplete" type="submit">
								<s:text name="input.newvital.SaveVital" />
							</button>
						</div>
					</s:form>			
				</div>
			</div>
		</div>

	<script type="text/javascript">
		$(document).ready(function() {

			$('.valuechanger').click(function(e){
				e.preventDefault();
			});
			
			$('#timepicker').timepicker({
				showMeridian : false,
				minuteStep : 1
			});

			function validNumber(code) {
				if (!(code == 8 || code == 46
						|| (code >= 35 && code <= 40)
						|| (code >= 48 && code <= 57) || (code >= 96 && code <= 105))) {
					return false;
				} else {
					return true;
				}
			}

			$('.INTEGER').keydown(function(e) {
				var key = (e.which) ? e.which : e.keyCode;
				if (!validNumber(key)) {
					e.preventDefault();
				}
			});

			$('.DOUBLE').keydown(function(e) {
				var key = (e.which) ? e.which: e.keyCode;
				if (!validNumber(key) && key != 190 && key != 110) {
					e.preventDefault();
				} else {
					if (($(this).val().indexOf(".")) >= 0 && (key == 190 || key == 110)) {
						e.preventDefault();
					}
				}

			});

			$('#btnCurrentTime').click( function() {
				var time = new Date();
				$('#timepicker').prop('value',	time.getHours() + ":" + time.getMinutes());
				setPlannedTime();
			});

			$('#timepicker').change(function () {
				setPlannedTime();
			});
			
			setPlannedTime();
			
			function setPlannedTime(){
				var plannedTime = $('#timepicker').val();
				$("input[id=plannedTime]").val(plannedTime);
			}

		});
		
	</script>
	
	<s:include value="/WEB-INF/content/common/footer.jsp" />